package org.iteam.xlz.manager.utils;

import push.AndroidNotification;
import push.PushClient;
import push.android.AndroidBroadcast;
import push.android.AndroidCustomizedcast;
import push.ios.IOSBroadcast;
import push.ios.IOSCustomizedcast;

public class UmengDemo {
	
	@SuppressWarnings("unused")
	private UmengDemo(){}
	
	public String IosAppkey ="5812b35df43e4818ed002996";
	public String IosAppMasterSecret ="7cpm6ucxp1nupiadwas52ajm4xfkntgj";
	public String AndroidAppkey ="57e4c31e67e58e16b80039a3";
	public String AndroidAppMasterSecret ="7htd6tabwuz1qiawsads3du0yhe50g8w";
	private PushClient client = new PushClient();
	String ticker="来自小礼子的消息";
	String title="测试标题";
	String text="测试内容";
	String alert="测试内容";
	
	public UmengDemo(String ticker,String title,String text,String alert){
		this.ticker=ticker;
		this.title=title;
		this.text=text;
		this.alert=alert;
	}
	
	public void sendAndroidBroadcast() throws Exception {
		AndroidBroadcast broadcast = new AndroidBroadcast(AndroidAppkey,AndroidAppMasterSecret);
		broadcast.setTicker(ticker);
		broadcast.setTitle(title);
		broadcast.setText(text);
		broadcast.goAppAfterOpen();
		broadcast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION);
		broadcast.setProductionMode();
		client.send(broadcast);
	}
	
	public void sendAndroidCustomizedcast(AndroidCustomizedcast customizedcast) throws Exception {
		customizedcast.setTicker(ticker);
		customizedcast.setTitle(title);
		customizedcast.setText(text);
		customizedcast.goAppAfterOpen();
		customizedcast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION);
		customizedcast.setProductionMode();
		client.send(customizedcast);
	}
	
	public void sendIOSBroadcast() throws Exception {
		IOSBroadcast broadcast = new IOSBroadcast(IosAppkey,IosAppMasterSecret);
		broadcast.setAlert(alert);
		broadcast.setBadge( 0);
		broadcast.setSound( "default");
		broadcast.setProductionMode();
		client.send(broadcast);
	}
	
	public void sendIOSCustomizedcast(IOSCustomizedcast customizedcast) throws Exception {
		customizedcast.setAlert(alert);
		customizedcast.setBadge( 0);
		customizedcast.setSound( "default");
		//customizedcast.setProductionMode();
		customizedcast.setTestMode();
		client.send(customizedcast);
	}
	
	public PushClient getClient() {
		return client;
	}

	public void setClient(PushClient client) {
		this.client = client;
	}

	public String getTicker() {
		return ticker;
	}

	public void setTicker(String ticker) {
		this.ticker = ticker;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getAlert() {
		return alert;
	}

	public void setAlert(String alert) {
		this.alert = alert;
	}
}
